from django.db import models


# Create your models here.
class DataCycletime(models.Model):
    timestamp = models.DateTimeField(primary_key=True, db_comment="时间戳")  # The composite primary key (timestamp, endpointnum) found, that is not supported. The first column is selected.
    endpointnum = models.CharField(max_length=255, db_comment="设备端点编号")
    assetnum = models.CharField(max_length=255, db_comment="设备编号")
    data = models.FloatField(db_comment="机器节拍")
    overdata = models.FloatField(db_comment="超节拍数据")
    tag = models.CharField(max_length=255, blank=True, null=True, db_comment="标签")
    status = models.CharField(max_length=255, db_comment="状态正常节拍(OK)/超节拍(OVERFLOW)/无效节拍(INVALID)")
    createdate = models.DateTimeField(db_comment="创建时间")
    unloadtime = models.FloatField(db_comment="人工下料节拍(废弃)")
    loadtime = models.FloatField(db_comment="人工上料节拍")
    total = models.FloatField(db_comment="总节拍=Data+UnloadTime")
    modifydate = models.DateTimeField(blank=True, null=True, db_comment="修改时间")

    class Meta:
        managed = False
        db_table = "data_cycletime"
        unique_together = (("timestamp", "endpointnum"),)
        db_table_comment = "循环节拍数据记录"


class DataPartcount(models.Model):
    timestamp = models.DateTimeField(primary_key=True, db_comment="时间戳")  # The composite primary key (timestamp, endpointnum, counttype) found, that is not supported. The first column is selected.
    endpointnum = models.CharField(max_length=255, db_comment="设备端点编号")
    assetnum = models.CharField(max_length=255, db_comment="设备编号")
    counttype = models.CharField(max_length=255, db_comment="工件计数类型,Good(合格)/Reject(不合格)")
    data = models.FloatField(db_comment="数据值")
    createdate = models.DateTimeField(db_comment="创建时间")

    class Meta:
        managed = False
        db_table = "data_partcount"
        unique_together = (("timestamp", "endpointnum", "counttype"),)
        db_table_comment = "设备产量记录"


class DataFaultcode(models.Model):
    fault_id = models.IntegerField(db_comment='��������¼ID')
    timestamp = models.DateTimeField(primary_key=True, db_comment='ʱ���')  # The composite primary key (timestamp, endpointnum, assetnum) found, that is not supported. The first column is selected.
    endpointnum = models.CharField(max_length=255, db_comment='�豸�˵���')
    assetnum = models.CharField(max_length=255, db_comment='�豸���')
    data = models.FloatField(db_comment='������')

    class Meta:
        managed = False
        db_table = 'data_faultcode'
        unique_together = (('timestamp', 'endpointnum', 'assetnum'),)
        db_table_comment = '故障码'


class DataMachinefault(models.Model):
    endpointnum = models.CharField(max_length=255, db_comment='�豸�˵���')
    assetnum = models.CharField(max_length=255, db_comment='�豸���')
    faulttime = models.DateTimeField(db_comment='���Ϸ���ʱ��')
    andontime = models.DateTimeField(blank=True, null=True, db_comment='��������ʱ��')
    andon_acktime = models.DateTimeField(blank=True, null=True, db_comment='����ȷ��ʱ��')
    autotime = models.DateTimeField(blank=True, null=True, db_comment='�Զ�ѭ������ʱ��')
    duration = models.FloatField(db_comment='����ʱ��,��λ����')
    createdate = models.DateTimeField(db_comment='����ʱ��')

    class Meta:
        managed = False
        db_table = 'data_machinefault'
        db_table_comment = '�豸��������¼'


class DataShiftcount(models.Model):
    timestamp = models.DateTimeField(primary_key=True, db_comment='ʱ���')  # The composite primary key (timestamp, endpointnum, assetnum) found, that is not supported. The first column is selected.
    endpointnum = models.CharField(max_length=255, db_comment='�豸�˵���')
    assetnum = models.CharField(max_length=255, db_comment='�豸���')
    goodcount = models.FloatField(db_comment='�ϸ�Ʒ����')
    rejectcount = models.FloatField(db_comment='���ϸ�Ʒ����')
    shift = models.IntegerField(db_comment='��Σ���1��ʼ')
    day = models.CharField(max_length=255, db_comment='����ֵ')

    class Meta:
        managed = False
        db_table = 'data_shiftcount'
        unique_together = (('timestamp', 'endpointnum', 'assetnum'),)
        db_table_comment = '��β�������'


class DataTooldoortime(models.Model):
    timestamp = models.DateTimeField(primary_key=True)  # The composite primary key (timestamp, EndpointNum) found, that is not supported. The first column is selected.
    endpointnum = models.CharField(db_column='EndpointNum', max_length=255)  # Field name made lowercase.
    assetnum = models.CharField(db_column='AssetNum', max_length=255, blank=True, null=True)  # Field name made lowercase.
    data = models.FloatField(db_column='Data')  # Field name made lowercase.

    class Meta:
        managed = False
        db_table = 'data_tooldoortime'
        unique_together = (('timestamp', 'endpointnum'),)


class SummaryCycletime(models.Model):
    assetnum = models.CharField(max_length=255, db_comment='�豸���')
    endpointnum = models.CharField(max_length=255, db_comment='�豸�˵���')
    day = models.CharField(max_length=255, db_comment='����')
    count1 = models.IntegerField(db_comment='�������ۼƴ���(0-1)')
    time1 = models.FloatField(db_comment='�������ۼ�ʱ��(0-1)')
    count2 = models.IntegerField(db_comment='�������ۼƴ���(1-2)')
    time2 = models.FloatField(db_comment='�������ۼ�ʱ��(1-2)')
    count3 = models.IntegerField(db_comment='�������ۼƴ���(2-3)')
    time3 = models.FloatField(db_comment='�������ۼ�ʱ��(2-3)')
    count4 = models.IntegerField(db_comment='�������ۼƴ���(3-4)')
    time4 = models.FloatField(db_comment='�������ۼ�ʱ��(3-4)')
    count5 = models.IntegerField(db_comment='�������ۼƴ���(4-5)')
    time5 = models.FloatField(db_comment='�������ۼ�ʱ��(4-5)')
    count6 = models.IntegerField(db_comment='�������ۼƴ���(5-6)')
    time6 = models.FloatField(db_comment='�������ۼ�ʱ��(5-6)')
    count7 = models.IntegerField(db_comment='�������ۼƴ���(6-7)')
    time7 = models.FloatField(db_comment='�������ۼ�ʱ��(6-7)')
    count8 = models.IntegerField(db_comment='�������ۼƴ���(7-8)')
    time8 = models.FloatField(db_comment='�������ۼ�ʱ��(7-8)')
    count9 = models.IntegerField(db_comment='�������ۼƴ���(8-9)')
    time9 = models.FloatField(db_comment='�������ۼ�ʱ��(8-9)')
    count10 = models.IntegerField(db_comment='�������ۼƴ���(9-10)')
    time10 = models.FloatField(db_comment='�������ۼ�ʱ��(9-10)')
    count11 = models.IntegerField(db_comment='�������ۼƴ���(10-11)')
    time11 = models.FloatField(db_comment='�������ۼ�ʱ��(10-11)')
    count12 = models.IntegerField(db_comment='�������ۼƴ���(11-12)')
    time12 = models.FloatField(db_comment='�������ۼ�ʱ��(11-12)')
    count13 = models.IntegerField(db_comment='�������ۼƴ���(12-13)')
    time13 = models.FloatField(db_comment='�������ۼ�ʱ��(12-13)')
    count14 = models.IntegerField(db_comment='�������ۼƴ���(13-14)')
    time14 = models.FloatField(db_comment='�������ۼ�ʱ��(13-14)')
    count15 = models.IntegerField(db_comment='�������ۼƴ���(14-15)')
    time15 = models.FloatField(db_comment='�������ۼ�ʱ��(14-15)')
    count16 = models.IntegerField(db_comment='�������ۼƴ���(15-16)')
    time16 = models.FloatField(db_comment='�������ۼ�ʱ��(15-16)')
    count17 = models.IntegerField(db_comment='�������ۼƴ���(16-17)')
    time17 = models.FloatField(db_comment='�������ۼ�ʱ��(16-17)')
    count18 = models.IntegerField(db_comment='�������ۼƴ���(17-18)')
    time18 = models.FloatField(db_comment='�������ۼ�ʱ��(17-18)')
    count19 = models.IntegerField(db_comment='�������ۼƴ���(18-19)')
    time19 = models.FloatField(db_comment='�������ۼ�ʱ��(18-19)')
    count20 = models.IntegerField(db_comment='�������ۼƴ���(19-20)')
    time20 = models.FloatField(db_comment='�������ۼ�ʱ��(19-20)')
    count21 = models.IntegerField(db_comment='�������ۼƴ���(20-21)')
    time21 = models.FloatField(db_comment='�������ۼ�ʱ��(20-21)')
    count22 = models.IntegerField(db_comment='�������ۼƴ���(21-22)')
    time22 = models.FloatField(db_comment='�������ۼ�ʱ��(21-22)')
    count23 = models.IntegerField(db_comment='�������ۼƴ���(22-23)')
    time23 = models.FloatField(db_comment='�������ۼ�ʱ��(22-23)')
    count24 = models.IntegerField(db_comment='�������ۼƴ���(23-24)')
    time24 = models.FloatField(db_comment='�������ۼ�ʱ��(23-24)')
    totalcount = models.IntegerField(db_comment='�����ۼƳ����Ĵ���')
    totaltime = models.FloatField(db_comment='�����ۼƳ�����ʱ��')
    createby = models.CharField(max_length=255, db_comment='������')
    createdate = models.DateTimeField(db_comment='��������')
    modifyby = models.CharField(max_length=255, blank=True, null=True, db_comment='�޸���')
    modifydate = models.DateTimeField(blank=True, null=True, db_comment='�޸�����')

    class Meta:
        managed = False
        db_table = 'summary_cycletime'
        db_table_comment = 'ѭ������ͳ������'


class SummaryPartcount(models.Model):
    assetnum = models.CharField(max_length=255, db_comment='�豸���')
    day = models.CharField(max_length=255, db_comment='����')
    goodcount1 = models.IntegerField(db_comment='�ϸ񹤼�����(0-1)')
    rejectcount1 = models.IntegerField(db_comment='���ϸ񹤼�����(0-1)')
    goodcount2 = models.IntegerField(db_comment='�ϸ񹤼�����(1-2)')
    rejectcount2 = models.IntegerField(db_comment='���ϸ񹤼�����(1-2)')
    goodcount3 = models.IntegerField(db_comment='�ϸ񹤼�����(2-3)')
    rejectcount3 = models.IntegerField(db_comment='���ϸ񹤼�����(2-3)')
    goodcount4 = models.IntegerField(db_comment='�ϸ񹤼�����(3-4)')
    rejectcount4 = models.IntegerField(db_comment='���ϸ񹤼�����(3-4)')
    goodcount5 = models.IntegerField(db_comment='�ϸ񹤼�����(4-5)')
    rejectcount5 = models.IntegerField(db_comment='���ϸ񹤼�����(4-5)')
    goodcount6 = models.IntegerField(db_comment='�ϸ񹤼�����(5-6)')
    rejectcount6 = models.IntegerField(db_comment='���ϸ񹤼�����(5-6)')
    goodcount7 = models.IntegerField(db_comment='�ϸ񹤼�����(6-7)')
    rejectcount7 = models.IntegerField(db_comment='���ϸ񹤼�����(6-7)')
    goodcount8 = models.IntegerField(db_comment='�ϸ񹤼�����(7-8)')
    rejectcount8 = models.IntegerField(db_comment='���ϸ񹤼�����(7-8)')
    goodcount9 = models.IntegerField(db_comment='�ϸ񹤼�����(8-9)')
    rejectcount9 = models.IntegerField(db_comment='���ϸ񹤼�����(8-9)')
    goodcount10 = models.IntegerField(db_comment='�ϸ񹤼�����(8-9)')
    rejectcount10 = models.IntegerField(db_comment='���ϸ񹤼�����(9-10)')
    goodcount11 = models.IntegerField(db_comment='�ϸ񹤼�����(10-11)')
    rejectcount11 = models.IntegerField(db_comment='���ϸ񹤼�����(10-11)')
    goodcount12 = models.IntegerField(db_comment='�ϸ񹤼�����(11-12)')
    rejectcount12 = models.IntegerField(db_comment='���ϸ񹤼�����(11-12)')
    goodcount13 = models.IntegerField(db_comment='�ϸ񹤼�����(12-13)')
    rejectcount13 = models.IntegerField(db_comment='���ϸ񹤼�����(12-13)')
    goodcount14 = models.IntegerField(db_comment='�ϸ񹤼�����(13-14)')
    rejectcount14 = models.IntegerField(db_comment='���ϸ񹤼�����(13-14)')
    goodcount15 = models.IntegerField(db_comment='�ϸ񹤼�����(14-15)')
    rejectcount15 = models.IntegerField(db_comment='���ϸ񹤼�����(14-15)')
    goodcount16 = models.IntegerField(db_comment='�ϸ񹤼�����(15-16)')
    rejectcount16 = models.IntegerField(db_comment='���ϸ񹤼�����(15-16)')
    goodcount17 = models.IntegerField(db_comment='�ϸ񹤼�����(16-17)')
    rejectcount17 = models.IntegerField(db_comment='���ϸ񹤼�����(16-17)')
    goodcount18 = models.IntegerField(db_comment='�ϸ񹤼�����(17-18)')
    rejectcount18 = models.IntegerField(db_comment='���ϸ񹤼�����(17-18)')
    goodcount19 = models.IntegerField(db_comment='�ϸ񹤼�����(18-19)')
    rejectcount19 = models.IntegerField(db_comment='���ϸ񹤼�����(18-19)')
    goodcount20 = models.IntegerField(db_comment='�ϸ񹤼�����(19-20)')
    rejectcount20 = models.IntegerField(db_comment='���ϸ񹤼�����(19-20)')
    goodcount21 = models.IntegerField(db_comment='�ϸ񹤼�����(20-21)')
    rejectcount21 = models.IntegerField(db_comment='���ϸ񹤼�����(20-21)')
    goodcount22 = models.IntegerField(db_comment='�ϸ񹤼�����(21-22)')
    rejectcount22 = models.IntegerField(db_comment='���ϸ񹤼�����(21-22)')
    goodcount23 = models.IntegerField(db_comment='�ϸ񹤼�����(22-23)')
    rejectcount23 = models.IntegerField(db_comment='���ϸ񹤼�����(22-23)')
    goodcount24 = models.IntegerField(db_comment='�ϸ񹤼�����(23-24)')
    rejectcount24 = models.IntegerField(db_comment='���ϸ񹤼�����(23-24)')
    goodtotal = models.IntegerField(db_comment='�ܼƺϸ����')
    rejecttotal = models.IntegerField(db_comment='�ܼƲ��ϸ����')
    createby = models.CharField(max_length=255, db_comment='������')
    createdate = models.DateTimeField(db_comment='��������')
    modifyby = models.CharField(max_length=255, blank=True, null=True, db_comment='�޸���')
    modifydate = models.DateTimeField(blank=True, null=True, db_comment='�޸�����')

    class Meta:
        managed = False
        db_table = 'summary_partcount'
        db_table_comment = '������������'


class ToolChangTime(models.Model):
    assetnum = models.CharField(max_length=255, db_comment='�豸���')
    toolnumber = models.IntegerField(db_comment='���߱��')
    starttime = models.DateTimeField(db_comment='������ʼʱ��')
    endtime = models.DateTimeField(db_comment='��������ʱ��')
    duration = models.FloatField(db_comment='������ʱ,��λ��')
    location = models.CharField(max_length=255, db_comment='����ģ��')
    op = models.CharField(max_length=255, blank=True, null=True, db_comment='��λ��')
    old_maxlife = models.IntegerField(db_comment='�ɵ�Ԥ������')
    new_maxlife = models.IntegerField(db_comment='�µ�Ԥ������')
    old_actuallife = models.IntegerField(db_comment='�ɵ�ʹ������')
    new_actuallife = models.IntegerField(db_comment='�µ�ʹ������')
    old_restlife = models.IntegerField(db_comment='�ɵ�ʣ������')
    new_restlife = models.IntegerField(db_comment='�µ�ʣ������')
    old_blocknumber = models.CharField(max_length=255, blank=True, null=True, db_comment='������')
    new_blocknumber = models.CharField(max_length=255, blank=True, null=True, db_comment='������')
    createdate = models.DateTimeField(db_comment='����ʱ��')

    class Meta:
        managed = False
        db_table = 'tool_chang_time'
        db_table_comment = '���߻�����ʱ'